package com.sumer.psychology.common.event;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;

/**
 * 从event里剥离出event content
 * <p/>
 * Created by twer on 15/8/29.
 */
public class EventJsonUtil {
    public static String filterEvent(String eventJsonString) {
        JsonObject jsonObject = new JsonParser().parse(eventJsonString).getAsJsonObject();
        JsonObject eventBody = jsonObject.getAsJsonObject("event");
        if (eventBody == null) {
            return eventJsonString;
        }
        eventBody.remove("eventVersion");
        eventBody.remove("occurredOn");
        return eventBody.toString();
    }
}
